﻿@{
    ViewBag.Title = "权限分配";
    Layout = "~/Views/Shared/_LayoutNew4.cshtml";
}

@section HeadSection{

    <link href="~/css/Employee.css" rel="stylesheet" />
    <link href="~/css/AuthorityAssign.css" rel="stylesheet" />
    <link href="~/css/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
    <link href="/css/ace/ace.min.css" rel="stylesheet">
    <link href="/css/ace/ace-rtl.min.css" rel="stylesheet">
    <link href="/css/ace/ace-skins.min.css" rel="stylesheet">
    <script src="/js/ace/ace-extra.min.js"></script>

}

@section FootScript{

    <script type="text/javascript" src="~/js/Services/ViewServices.js?r=201604250001"></script>
    <script type="text/javascript" src="~/js/AuthorityAssign/AuthorityAssign.js?r=20160406009"></script>
    <script type="text/javascript" src="~/js/bootstrap-table/bootstrap-table.min.js"></script>
    <script type="text/javascript" src="~/js/bootstrap-table/bootstrap-table-locale-all.min.js"></script>

}

<div ng-app="AuthorityAssign" id="AuthorityAssign">
    <div ng-controller="AuthorityAssignController" ng-init="initial()">
        <div class="container-fluid">
            <div class="row">
                <div class="col-lg-12">
                    <div class="widget-box">
                        <div class="widget-header">
                            <h4 class="smaller"><i class="icon-check"></i>权限配置</h4>
                        </div>
                        <div class="widget-body">
                            <div class="widget-main">
                                <div>
                                    <!-- Nav tabs -->
                                    <ul class="nav nav-tabs" role="tablist">
                                        <li role="presentation" class="active"><a href="#userAuthority" aria-controls="home" role="tab" data-toggle="tab">用户权限配置</a></li>
                                        <li role="presentation"><a href="#roleAuthority" aria-controls="profile" role="tab" data-toggle="tab">角色权限配置</a></li>
                                    </ul>
                                    <!-- Tab panes -->
                                    <div class="tab-content">
                                        <div role="tabpanel" class="tab-pane active" id="userAuthority">
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="row">
                                                        <div class="col-lg-12">
                                                            <table id="userTable" data-toggle="table" data-striped="true"
                                                                   data-show-pagination-switch="false"
                                                                   data-pagination="true"
                                                                   data-page-list="[10, 25, 50, 100, ALL]"
                                                                   data-id-field="Id"
                                                                   data-locale="zh-CN">
                                                                <thead class="tableHeader">
                                                                    <tr>
                                                                        <th data-align="center" data-halign="center" data-valign="middle" data-formatter="rowNumberFormatter" data-width="100">序号</th>
                                                                        <th data-field="Id" data-visible="false" data-align="center" data-halign="center" data-valign="middle">userId</th>
                                                                        <th data-field="Name" data-sortable="true" data-align="center" data-halign="center" data-valign="middle">用户名称</th>
                                                                        <th data-field="Code" data-sortable="true" data-align="center" data-halign="center" data-valign="middle">用户编号</th>
                                                                        <th data-field="Description" data-sortable="true" data-align="center" data-halign="center" data-valign="middle">备注</th>
                                                                        <th data-align="center" data-halign="center" data-valign="middle" data-events="operateEvents" data-formatter="controlFormatter">操作</th>
                                                                    </tr>
                                                                </thead>
                                                            </table>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div role="tabpanel" class="tab-pane" id="roleAuthority">
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="row">
                                                        <div class="col-lg-12">
                                                            <table id="roleTable" data-toggle="table" data-striped="true"
                                                                   data-show-pagination-switch="false"
                                                                   data-pagination="true"
                                                                   data-page-list="[10, 25, 50, 100, ALL]"
                                                                   data-id-field="Id"
                                                                   data-locale="zh-CN">
                                                                <thead class="tableHeader">
                                                                    <tr>
                                                                        <th data-align="center" data-halign="center" data-valign="middle" data-formatter="rowNumberFormatter" data-width="100">序号</th>
                                                                        <th data-field="Id" data-visible="false" data-align="center" data-halign="center" data-valign="middle">roleId</th>
                                                                        <th data-field="Name" data-sortable="true" data-align="center" data-halign="center" data-valign="middle">角色名称</th>
                                                                        <th data-field="Description" data-sortable="true" data-align="center" data-halign="center" data-valign="middle">备注</th>
                                                                        <th data-align="center" data-halign="center" data-valign="middle" data-events="operateRoleEvents" data-formatter="controlRoleFormatter">操作</th>
                                                                    </tr>
                                                                </thead>
                                                            </table>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal fade" id="AuthModal" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" ng-bind-template="{{info.title}}"></h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="widget-box">
                                    <div class="widget-header"><h4 class="smaller">当前权限</h4></div>
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <div id="currentAuthList">
                                                <span class="{{cAuth.displayClass}}" ng-bind-template="{{cAuth.Name}}" ng-repeat="cAuth in info.CurrentAuthorityList" data-id="{{cAuth.Id}}"></span>
                                            </div>
                                            <hr />
                                            <div>
                                                <small>
                                                    说明:
                                                </small>
                                                <small>
                                                    <span class="label label-success">绿色</span>：属于角色
                                                </small>
                                                <small>
                                                    <span class="label label-info">蓝色</span>：属于附加权限
                                                </small>
                                                <small>
                                                    <span class="label label-warning">橙色</span>：属于角色以及附加权限
                                                </small>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="widget-box">
                                    <div class="widget-header"><h4 class="smaller">角色<small>(点击标签进行添加以及删除权限的操作)</small></h4></div>
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <div id="roleList">
                                                <a role="button" class="{{role.displayClass}}" ng-bind-template="{{role.Name}}" ng-repeat="role in info.RoleList" ng-click="toggleRole(this)" data-id="{{role.Id}}"></a>
                                            </div>
                                            <hr />
                                            <div>
                                                <small>
                                                    说明:
                                                </small>
                                                <small>
                                                    <span class="label NoAuth">灰色</span>：未分配
                                                </small>
                                                <small>
                                                    <span class="label label-success">绿色</span>：已分配
                                                </small>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-lg-6">
                                <div class="widget-box">
                                    <div class="widget-header"><h4 class="smaller">附加权限<small>(点击标签进行添加以及删除权限的操作)</small></h4></div>
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <div id="authorityList">
                                                <a role="button" class="{{authority.displayClass}}" ng-bind-template="{{authority.Name}}" data-id="{{authority.AuthorityId}}" ng-repeat="authority in info.AuthorityList" ng-click="toggleAuthority(this)"></a>
                                            </div>
                                            <hr />
                                            <div>
                                                <small>
                                                    说明:
                                                </small>
                                                <small>
                                                    <span class="label NoAuth">灰色</span>：未分配
                                                </small>
                                                <small>
                                                    <span class="label label-info">蓝色</span>：已分配
                                                </small>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default CyScadaBtn" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>

        <div class="modal fade" id="RoleModal" tabindex="-1" role="dialog">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title" ng-bind-template="{{roleInfo.title}}"></h4>
                    </div>
                    <div class="modal-body">
                        <div class="row">
                            <div class="col-lg-12">
                                <div class="widget-box">
                                    <div class="widget-header">权限<small>(点击标签进行添加以及删除权限的操作)</small></div>
                                    <div class="widget-body">
                                        <div class="widget-main">
                                            <div id="authorityList">
                                                <a role="button" class="{{authority.displayClass}}" ng-bind-template="{{authority.Name}}" data-id="{{authority.AuthorityId}}" ng-repeat="authority in roleInfo.AuthorityList" ng-click="toggleRoleAuthority(this)"></a>
                                            </div>
                                            <hr />
                                            <div>
                                                <small>
                                                    说明:
                                                </small>
                                                <small>
                                                    <span class="label NoAuth">灰色</span>：未分配
                                                </small>
                                                <small>
                                                    <span class="label label-success">绿色</span>：已分配
                                                </small>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default CyScadaBtn" data-dismiss="modal">关闭</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



